package struts.form;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullBean  {
	public FullBean(){
		
	}
	
	public static Form getBean(String className,HttpServletRequest req) throws Exception{
		Form obj = null;
		try {
			Class clazz = Class.forName(className);
			obj = (Form)clazz.newInstance();
			Field[] list = clazz.getDeclaredFields();
			for (Field field : list) {
				field.setAccessible(true);
				field.set(obj, req.getParameter(field.getName()));
				field.setAccessible(false);
			}
			
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return obj;
	}
}
